#ifndef _PAN_SM1668_H_
#define _PAN_SM1668_H_

#define PW_CLK	1
#define T_WAIT	2

/************************************************************************/
#define	VFD_GRID_NUM				7
#define	VFD_BYTES_PER_GRID 		2
#define VFD_BUF_SIZE (VFD_GRID_NUM * VFD_BYTES_PER_GRID)
#define LED_OFF 0x87
#define	VFD_CMD_DISPLAY_MODE		0x00
#define	VFD_CMDSET_7GRID_DISPLAY_MODE	0x03
#define	VFD_CMDSET_6GRID_DISPLAY_MODE	0x02
#define	VFD_CMD_WRITE_DISP_MEM	0x40
#define	VFD_CMD_WRITE_LED_PORT	0x41
#define	VFD_CMD_KEY_SCAN			0x42
#define	VFD_CMD_DISPLAY_ON		0x8f
#define 	VFD_CMD_DSPLAY_ADDR_SET	0xc0

#define	VFD_KEY_ARRAY_BYTE_SIZE	5//6
#define	VFD_KEY_NULL	0x3f
#define	VFD_POWER_KEY 0x01
#define  VFD_REC_KEY     0x08
#define   VFD_PLAY_KEY 0x01
#define   VFD_MENU_KEY 0x10
#define   VFD_EXIT_KEY  0x02
#define	VFD_DOWN_KEY		0x10
#define	VFD_UP_KEY		0x2
#define   VFD_OK_KEY   0x8
#define   VFD_LEFT_KEY 0x08
#define   VFD_RIGHT_KEY 0x01

//SG1:0,SG2:1,SG3:2 ... SG16:15
#define START_SG_TO_LED 2
#define RED_LED_CONTROL_SG 12
#define GRE_LED_CONTROL_SG 13

typedef struct{
UINT8 vfd_k;
UINT32 host_k;
UINT8 byte_inx;
}VFD_HOST_KMAP;

#define _PAN_SM1668_H_
#define PW_CLK	1
#define T_WAIT	2

/************************************************************************/
#define CMD1_PREFIX		0x40
#define PT6958_NORMAL_MODE	(0<<3)
#define PT6958_TEST_MODE		(1<<3)

#define INCRE_ADDR		(0<<2)
#define FIXED_ADDR		(1<<2)

#define WRITE_DATA		(0)
#define READ_KEY		(2)

#define CMD1_READ		(CMD1_PREFIX|PT6958_NORMAL_MODE|INCRE_ADDR|READ_KEY)
//#define CMD1_READ		(CMD1_PREFIX|PT6958_NORMAL_MODE|FIXED_ADDR|READ_KEY)

#define CMD1_WRITE_INCRE		(CMD1_PREFIX|PT6958_NORMAL_MODE|INCRE_ADDR|WRITE_DATA)
#define CMD1_WRITE_FIXED		(CMD1_PREFIX|PT6958_NORMAL_MODE|FIXED_ADDR|WRITE_DATA)

/************************************************************************/
#define CMD2_PREFIX		0xc0
#define CMD2_ADDR(addr)	(CMD2_PREFIX|(addr&0xf))

/************************************************************************/
#define CMD3_PREFIX		0x80

#define DISPLAY_OFF		(0<<3)
#define DISPLAY_ON		(1<<3)

#define DIM_1_16		0
#define DIM_2_16		1
#define DIM_4_16		2
#define DIM_10_16		3
#define DIM_11_16		4
#define DIM_12_16		5
#define DIM_13_16		6
#define DIM_14_16		7
/************************************************************************/
#define LED_OFF			(CMD3_PREFIX|DISPLAY_OFF|DIM_14_16)
#define LED_ON			(CMD3_PREFIX|DISPLAY_ON|DIM_14_16)

#define CMD4_PREFIX		0x00
#define BYTES4_SG13		0x00
#define BYTES5_SG12		0x01
#define BYTES6_SG11		0x02
#define BYTES7_SG10		0x03
#endif /*_PAN_PT6958_H_*/
